package com.start.boot.service.impl;

import com.start.boot.dao.ajpc.UserMapper;
import com.start.boot.domain.Rybm;
import com.start.boot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by lenovo on 2017/10/16.
 * 用户逻辑层：
 */

@Service
public class UserServiceImpl  implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public void GetDwbmCombTree(Map map) {
        userMapper.GetDwbmCombTree(map);
    }

    @Override
    public void TyywNewUserList(Map map) {
        userMapper.TyywNewUserList(map);
    }

    @Override
    public void GetUserList(Map map) {
        userMapper.GetUserList(map);
    }

    @Override
    @Transactional
    public String addOrUpdateRybm(Map<String,String> map) {
        String errmsg=null;

        if("AddUser".equals(map.get("action"))){

            map.remove("p_xdwbm");
            userMapper.AddUser(map);
             errmsg = map.get("p_errmsg");

        }else {
            userMapper.UpdateUser(map);
            errmsg =map.get("p_errmsg");
        }

        return errmsg;

    }

    @Override
    public void GetUserByGh(Map map) {
        userMapper.GetUserByGh(map);
    }

    @Override
    public void DeleteUser(Map map) {
        userMapper.DeleteUser(map);
    }

    @Override
    public void ResetUserPwd(Map map) {
        userMapper.ResetUserPwd(map);
    }

    @Override
    public void UserSync(Map map) {
        userMapper.UserSync(map);
    }


}
